local assets =
{
    -- Asset("ANIM", "anim/panda_fisherman_supply_pack.zip"),
    Asset( "IMAGE", "images/inventoryimages/npc_item_no_discounts_amulet.tex" ),  -- 背包贴图
    Asset( "ATLAS", "images/inventoryimages/npc_item_no_discounts_amulet.xml" ),
}
local function GetStringsTable()
    return TUNING.NPC_CHAT_TABLE[ type(TUNING.__NPC_LANGUAGE)=="function" and TUNING.__NPC_LANGUAGE() or TUNING.__NPC_LANGUAGE ] ["npc_item_no_discounts_amulet"] or {}
end

local function fn()
    local inst = CreateEntity()

    inst.entity:AddTransform()
    inst.entity:AddAnimState()
    inst.entity:AddNetwork()
    inst.entity:AddSoundEmitter()

    MakeInventoryPhysics(inst)

    inst.AnimState:SetBank("amulets")
    inst.AnimState:SetBuild("amulets")
    inst.AnimState:PlayAnimation("greenamulet")


    inst.entity:SetPristine()
    if not TheWorld.ismastersim then
        return inst
    end
    -- inst:AddComponent("npc_base_lib")
    inst:AddComponent("npc_everything_data")


    inst:AddComponent("inspectable") --可检查组件
    
    inst:AddComponent("inventoryitem")
    -- inst.components.inventoryitem:ChangeImageName("stash_map")
	inst.components.inventoryitem.cangoincontainer = true
    inst:AddComponent("named")
    inst.components.named:SetName(GetStringsTable().name)
    STRINGS.CHARACTERS.GENERIC.DESCRIBE[string.upper("npc_item_no_discounts_amulet")] = GetStringsTable().inspect_str  --人物检查的描述

    inst:AddComponent("equippable")
    inst.components.equippable.equipslot = EQUIPSLOTS.BODY
    inst.components.equippable.dapperness = TUNING.DAPPERNESS_SMALL
    inst.components.equippable.is_magic_dapperness = true

    inst:ListenForEvent("equipped",function(_,_table)
        if _table and _table.owner and _table.owner:HasTag("player") and _table.owner.components.playercontroller then
            local owner = _table.owner
            if owner.components.builder ~= nil then
                inst.npc_everything_data:Set("builder.ingredientmod",owner.components.builder.ingredientmod)
                owner.components.builder.ingredientmod = 1
            end
        end        
    end)

    inst:ListenForEvent("unequipped",function(_,_table)
        if _table and _table.owner and _table.owner:HasTag("player") and _table.owner.components.playercontroller and inst.npc_everything_data:Get("builder.ingredientmod") then
            local owner = _table.owner
            if owner.components.builder ~= nil then
                owner.components.builder.ingredientmod = inst.npc_everything_data:Get("builder.ingredientmod")
                inst.npc_everything_data:Set("builder.ingredientmod",nil)
            end
        end        
    end)

    return inst
end

return Prefab("npc_item_no_discounts_amulet", fn,assets)